﻿/*
 * main.h
 *
 * Created: 2014-03-13 19:53:22
 *  Author: Michał
 */ 


#ifndef MAIN_H_
#define MAIN_H_

#define LED_GREEN_PORT		PORTB
#define LED_GREEN_DDR		DDRB
#define LED_GREEN_PIN		PINB2
#define LED_GREEN_OFF		LED_GREEN_PORT &= ~(1<<LED_GREEN_PIN)
#define LED_GREEN_ON		LED_GREEN_PORT |= (1<<LED_GREEN_PIN)
#define LED_GREEN_TOGGLE	LED_GREEN_PORT ^= (1<<LED_GREEN_PIN)


#define CLK_PORT			PORTC
#define CLK_DDR				DDRC
#define CLK_PIN				PINC1
#define CLK_HIGH			CLK_PORT |= (1<<CLK_PIN)
#define CLK_LOW				CLK_PORT &= ~(1<<CLK_PIN)
#define CLK_PULSE			CLK_HIGH; CLK_LOW;


#define SI_PORT				PORTC
#define SI_DDR				DDRC
#define SI_PIN				PINC2
#define SI_HIGH				SI_PORT |= (1<<SI_PIN)
#define SI_LOW				SI_PORT &= ~(1<<SI_PIN)
#define SI_PULSE			SI_HIGH; SI_LOW;

#define LD_PORT				PORTC
#define LD_DDR				DDRC
#define LD_PIN				PINC2
#define LD_HIGH				LD_PORT |= (1<<LD_PIN)
#define LD_LOW				LD_PORT &= ~(1<<LD_PIN)
#define LD_PULSE			LD_HIGH;LD_LOW;LD_HIGH;

#define STCP_LEDS_PORT		PORTD
#define STCP_LEDS_DDR		DDRD
#define STCP_LEDS_PIN		PIND4
#define STCP_LEDS_HIGH		STCP_LEDS_PORT |= (1<<STCP_LEDS_PIN)
#define STCP_LEDS_LOW		STCP_LEDS_PORT &= ~(1<<STCP_LEDS_PIN)
#define STCP_LEDS_PULSE		STCP_LEDS_HIGH; STCP_LEDS_LOW;


#define SWITCH1_PORT		PORTD
#define SWITCH1_DDR			DDRD
#define SWITCH1_PIN			PIND
#define SWITCH1_PIN_NUM		PIND7
#define SWITCH1_STATE		(SWITCH1_PIN & (1<<SWITCH1_PIN_NUM))

#define SWITCH2_PORT		PORTD
#define SWITCH2_DDR			DDRD
#define SWITCH2_PIN			PIND
#define SWITCH2_PIN_NUM		PIND6
#define SWITCH2_STATE		(SWITCH1_PIN & (1<<SWITCH1_PIN_NUM))


#define DIP_SWITCH_PORT		PORTC
#define DIP_SWITCH_DDR		DDRC
#define DIP_SWITCH_PIN		PINC
#define DIP_SWITCH_PIN_NUM	PINC0
#define DIP_SWITCH_STATE	(DIP_SWITCH_PIN & (1<<DIP_SWITCH_PIN_NUM))




#endif /* MAIN_H_ */